﻿<%@ WebHandler Language="C#" Class="BrandHandler" %>

using System;
using System.Web;
using SeDuce.BLL;
using System.Collections.Generic;
using SeDuce.Model;
using System.Linq;

public class BrandHandler : IHttpHandler {

    Lazy_Yu<BrandBLL> lazyBrandBLL = new Lazy_Yu<BrandBLL>(() => new BrandBLL());
    public BrandBLL LazyBrandBLL
    {
        get { return this.lazyBrandBLL.Value; }
    }
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        List<Brand> brands = LazyBrandBLL.GetBrands().ToList<Brand>().OrderBy(t => t.Sort).ToList<Brand>();
        context.Response.Write(brands.ToJSON());
        context.Response.End();
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}